package com.itheima.reggie.mapper;

import com.itheima.reggie.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @Author: qingtao
 * @Date 2022/3/15 9:18
 */
public interface SetmealDishMapper {

    /**
     * 批量添加
     * @param setmealDishList
     * @return
     */
    Integer save(@Param("setmealDishList") List<SetmealDish> setmealDishList);

    /**
     * 删除
     * @param ids
     * @param updateUser
     * @param updateTime
     * @return
     */
    Integer delete(@Param("ids") List<Long> ids,
                   @Param("updateUser") Long updateUser,
                   @Param("updateTime") LocalDateTime updateTime);

    /**
     * 删除所有菜品
     * @param setmealId
     * @return
     */
    @Delete("delete from setmeal_dish where setmeal_id=#{setmealId}")
    Integer deleteByDishId(Long setmealId);

    /**
     * 根据ID查询
     * @param setmealId
     * @return
     */
    @Select("select * from setmeal_dish where setmeal_id=#{setmealId}")
    List<SetmealDish> findBySetmealId(Long setmealId);
}
